function bindActionCreator(actionCreator,dispatch){
    return function(){
        return dispatch(actionCreator.apply(this,arguments));
    }
}

//为了省去每次在actions中的方法里每次store.dispatch
function bindActionCreators(actionCreators,dispatch){
    if(typeof actionCreators === 'function'){
        bindActionCreator(actionCreators, dispatch);
    }

    const boundActionCreators = {};
    for(const key in actionCreators){
        boundActionCreators[key] = bindActionCreator(actionCreators[key], dispatch);
    }

    return boundActionCreators;
}

export default bindActionCreators;
